package com.guli.order.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/*
 * @Author 罗俊
 * @date 2020/11/18 - 3:03 下午
 *
 */
@Configuration
public class ThreadPoolConfig {

    @Bean
    public ExecutorService executorService() {

        LinkedBlockingDeque<Runnable> queues = new LinkedBlockingDeque<>();

        return new ThreadPoolExecutor(2, 5, 30, TimeUnit.SECONDS, queues);
    }
}
